package net.huashitong.ssydt.base.service;

import net.huashitong.ssydt.base.dao.BaseMapper;

import java.io.Serializable;

/**
 * @author <a href="mailto:yhy23456@163.com">huiyang.yu</a>
 * @since 2017.11.14
 */
public abstract class AbstractBaseService<T, I extends Serializable> implements BaseService<T, I> {

    protected abstract BaseMapper<T, I> getBaseMapper();

    @Override
    public int deleteByPrimaryKey(I id) {
        return getBaseMapper().deleteByPrimaryKey(id);
    }

    @Override
    public int insert(T record) {
        return getBaseMapper().insert(record);
    }

    @Override
    public int insertSelective(T record) {
        return getBaseMapper().insertSelective(record);
    }

    @Override
    public T selectByPrimaryKey(I id) {
        return getBaseMapper().selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(T record) {
        return getBaseMapper().updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(T record) {
        return getBaseMapper().updateByPrimaryKey(record);
    }
}
